package com.sky.mapper;

import com.sky.entity.OrderDetail;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OrderDetailMapper {
    @Insert("INSERT INTO order_detail(name, image, order_id, dish_id, setmeal_id, dish_flavor, number, amount) VALUES " +
            "(#{name},#{image},#{orderId},#{dishId},#{setmealId},#{dishFlavor},\n" +
            "             #{number},#{amount});")
    void insert(OrderDetail orderDetail) ;

    @Select("select * from order_detail where user_id = #{currentId}")
    List<OrderDetail> historyOrders(Long currentId);

    @Select("select * from order_detail where order_id = #{id}")
    List<OrderDetail> historyOrdersByOrderId(Long id);
}
